import request from '@/utils/request'

// 查询盘点单列表
export function listCheck(query) {
  return request({
    url: '/stock/check/list',
    method: 'post',
    data: query
  })
}

// 查询盘点差异单列表
export function listDiff(query) {
  return request({
    url: '/stock/check/listDiff',
    method: 'post',
    data: query
  })
}

// 查询盘点单详细
export function getCheck(id) {
  return request({
    url: '/stock/check/' + id,
    method: 'get'
  })
}

// 新增盘点单
export function addCheck(data) {
  return request({
    url: '/stock/check/add',
    method: 'post',
    data: data
  })
}

// 修改盘点单
export function updateCheck(data) {
  return request({
    url: '/stock/check/update',
    method: 'post',
    data: data
  })
}

// 删除盘点单
export function delCheck(id) {
  return request({
    url: '/stock/check/delete/' + id,
    method: 'post'
  })
}

// 审核盘点单
export function audit(id) {
  return request({
    url: '/stock/check/audit/' + id,
    method: 'post'
  })
}

// 退回盘点单
export function auditCancel(id) {
  return request({
    url: '/stock/check/auditCancel/' + id,
    method: 'post'
  })
}

// 获取有差异的盘点信息
export function getDiffInfo(id) {
  return request({
    url: '/stock/check/getDiffInfo/' + id,
    method: 'get'
  })
}

// 确认差异
export function confirmDiff(data) {
  return request({
    url: '/stock/check/confirmDiff',
    method: 'post',
    data: data
  })
}

// 查询盘点单明细列表
export function listCheckItem(query) {
  return request({
    url: '/stock/checkitem/list',
    method: 'post',
    data: query
  })
}

// 生成差异
export function diffGen(id) {
  return request({
    url: '/stock/check/diffGen/' + id,
    method: 'post'
  })
}


// 盘点录入确认
export function entryConfirm(id) {
  return request({
    url: '/stock/check/entryconfirm/' + id,
    method: 'post'
  })
}

// 取消确认
export function entryCancel(id) {
  return request({
    url: '/stock/check/entrycancel/' + id,
    method: 'post'
  })
}

// 盘点录入保存并确认
export function saveAndEntryConfirm(data) {
  return request({
    url: '/stock/check/saveAndEntryConfirm',
    method: 'post',
    data: data
  })
}